package com.xbongbong.saas.enums;

import com.xbongbong.i18n.util.I18nMessageUtil;
import com.xbongbong.pro.enums.permission.enums.ProPermissionAliasEnum;
import lombok.Getter;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.Set;

/**
 * saas所有功能的按钮
 * 列表+详情
 *
 * @author haibin.zhang
 * @version v1.0
 * @date 2019/1/23 21:55
 * @since v1.0
 */
@Getter
public enum SaasSubButtonEnum {
    // 自定义导出功能按钮
    /**
     * 1.关联业务
     * 2.列表上哪个业务按钮下的子按钮
     * 3.按钮名称
     * 4.按钮别称
     * 5.icon
     * 6.包含权限
     *
     */
    //客户
    CUSTOMER_CUSTOM_EXPORT(XbbRefTypeEnum.CUSTOMER.getCode(),ListTopButtonEnum.CUSTOMER_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.CUSTOMER_EXPORT.getAlias()),
    CUSTOMER_FOCUS_CUSTOM_EXPORT(XbbRefTypeEnum.CUSTOMER_FOCUS.getCode(),ListTopButtonEnum.CUSTOMER_FOCUS_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.CUSTOMER_EXPORT.getAlias()),
    CUSTOMER_DEAL_CUSTOM_EXPORT(XbbRefTypeEnum.CUSTOMER_DEAL.getCode(),ListTopButtonEnum.CUSTOMER_DEAL_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.CUSTOMER_EXPORT.getAlias()),
    CUSTOMER_FOLLOW_CUSTOM_EXPORT(XbbRefTypeEnum.CUSTOMER_FOLLOW.getCode(),ListTopButtonEnum.CUSTOMER_FOLLOW_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.CUSTOMER_EXPORT.getAlias()),
    CUSTOMER_PUBLIC_CUSTOM_EXPORT(XbbRefTypeEnum.CUSTOMER_PUBLIC.getCode(),ListTopButtonEnum.CUSTOMER_PUBLIC_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.CUSTOMER_EXPORT.getAlias()),
    CUSTOMER_RECYCLE_CUSTOM_EXPORT(XbbRefTypeEnum.CUSTOMER_RECYCLE.getCode(),ListTopButtonEnum.CUSTOMER_RECYCLE_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.CUSTOMER_EXPORT.getAlias()),
    CUSTOMER_NEARBY_CUSTOM_EXPORT(XbbRefTypeEnum.CUSTOMER_NEARBY.getCode(),ListTopButtonEnum.CUSTOMER_NEARBY_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.CUSTOMER_EXPORT.getAlias()),

    //联系人
    CONTACT_CUSTOM_EXPORT(XbbRefTypeEnum.CONTACT.getCode(),ListTopButtonEnum.CONTACT_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.CUSTOMER_EXPORT.getAlias()),

    //合同
    CONTRACT_CUSTOM_EXPORT(XbbRefTypeEnum.CONTRACT.getCode(),ListTopButtonEnum.CONTRACT_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.CONTRACT_EXPORT.getAlias()),

    //机会
    OPPORTUNITY_CUSTOM_EXPORT(XbbRefTypeEnum.SALES_OPPORTUNITY.getCode(),ListTopButtonEnum.OPPORTUNITY_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.OPPORTUNITY_EXPORT.getAlias()),
    ALL_OPPORTUNITY_CUSTOM_EXPORT(XbbRefTypeEnum.ALL_OPPORTUNITY.getCode(),ListTopButtonEnum.ALL_OPPORTUNITY_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.OPPORTUNITY_EXPORT.getAlias()),
    KEY_OPPORTUNITY_CUSTOM_EXPORT(XbbRefTypeEnum.KEY_OPPORTUNITY.getCode(),ListTopButtonEnum.KEY_OPPORTUNITY_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.OPPORTUNITY_EXPORT.getAlias()),

    //跟进记录
    COMMUNICATE_CUSTOM_EXPORT(XbbRefTypeEnum.CUSTOMER_COMMUNICATE.getCode(),ListTopButtonEnum.COMMUNICATE_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.CUSTOMER_COMMUNICATE_EXPORT.getAlias()),

    //访客计划
    COMMUNICATE_PLAN_CUSTOM_EXPORT(XbbRefTypeEnum.COMMUNICATE_PLAN.getCode(),ListTopButtonEnum.COMMUNICATE_PLAN_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.COMMUNICATE_PLAN_EXPORT.getAlias()),

    //工作报告
    WORK_REPORT_CUSTOM_EXPORT(XbbRefTypeEnum.WORK_REPORT.getCode(),ListTopButtonEnum.WORK_REPORT_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.WORK_REPORT_EXPORT.getAlias()),

    //供应商
    SUPPLIER_CUSTOM_EXPORT(XbbRefTypeEnum.SUPPLIER.getCode(),ListTopButtonEnum.SUPPLIER_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.SUPPLIER_EXPORT.getAlias()),
    SUPPLIER_CONTACT_CUSTOM_EXPORT(XbbRefTypeEnum.SUPPLIER_CONTACT.getCode(),ListTopButtonEnum.SUPPLIER_CONTACT_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.SUPPLIER_EXPORT.getAlias()),

    //采购
    PURCHASE_CUSTOM_EXPORT(XbbRefTypeEnum.PURCHASE.getCode(),ListTopButtonEnum.PURCHASE_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.PURCHASE_EXPORT.getAlias()),
    RETURNED_PURCHASE_CUSTOM_EXPORT(XbbRefTypeEnum.RETURNED_PURCHASE.getCode(),ListTopButtonEnum.RETURNED_PURCHASE_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.RETURN_PURCHASE_EXPORT.getAlias()),

    //BOM清单
    BOM_BILL_CUSTOM_EXPORT(XbbRefTypeEnum.BOM_BILL.getCode(),ListTopButtonEnum.BOM_BILL_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.BOM_BILL_EXPORT.getAlias()),

    //生产单
    PRODUCTION_ORDER_CUSTOM_EXPORT(XbbRefTypeEnum.PRODUCTION_ORDER.getCode(),ListTopButtonEnum.PRODUCTION_ORDER_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.PRODUCTION_ORDER_EXPORT.getAlias()),

    //回款计划
    PAYMENT_CUSTOM_EXPORT(XbbRefTypeEnum.PAYMENT.getCode(),ListTopButtonEnum.PAYMENT_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.PAYMENT_EXPORT.getAlias()),

    //付款计划
    PAY_PLAN_CUSTOM_EXPORT(XbbRefTypeEnum.PAY_PLAN.getCode(),ListTopButtonEnum.PAY_PLAN_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.PAY_PLAN_EXPORT.getAlias()),

    //发票
    INVOICE_CUSTOM_EXPORT(XbbRefTypeEnum.INVOICE.getCode(),ListTopButtonEnum.INVOICE_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.INVOICE_EXPORT.getAlias()),

    //进项发票
    PURCHASE_INVOICE_CUSTOM_EXPORT(XbbRefTypeEnum.PURCHASE_INVOICE.getCode(),ListTopButtonEnum.PURCHASE_INVOICE_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.PURCHASE_INVOICE_EXPORT.getAlias()),

    //装配出入库单
    ASSEMBLE_CUSTOM_EXPORT(XbbRefTypeEnum.ASSEMBLE.getCode(),ListTopButtonEnum.ASSEMBLE_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.ASSEMBLE_EXPORT.getAlias()),

    // 采购入库单
    PURCHASE_INSTOCK_CUSTOM_EXPORT(XbbRefTypeEnum.PURCHASE_INSTOCK.getCode(),ListTopButtonEnum.PURCHASE_INSTOCK_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.PURCHASE_INSTOCK_EXPORT.getAlias()),

    // 销售退货入库单
    REFUND_INSTOCK_CUSTOM_EXPORT(XbbRefTypeEnum.REFUND_INSTOCK.getCode(),ListTopButtonEnum.REFUND_INSTOCK_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.REFUND_INSTOCK_EXPORT.getAlias()),

    // 其他入库单
    ROTHER_INSTOCK_CUSTOM_EXPORT(XbbRefTypeEnum.OTHER_INSTOCK.getCode(),ListTopButtonEnum.OTHER_INSTOCK_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.INSTOCK_EXPORT.getAlias()),

    // 生产入库单
    PRODUCTION_INSTOCK_CUSTOM_EXPORT(XbbRefTypeEnum.PRODUCTION_INSTOCK.getCode(),ListTopButtonEnum.PRODUCTION_INSTOCK_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.PRODUCTION_INSTOCK_EXPORT.getAlias()),

    // 生产退料单
    RETURNED_MATERIEL_INSTOCK_CUSTOM_EXPORT(XbbRefTypeEnum.RETURNED_MATERIEL_INSTOCK.getCode(),ListTopButtonEnum.RETURNED_MATERIEL_INSTOCK_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.RETURNED_MATERIEL_INSTOCK_EXPORT.getAlias()),

    // 销售出库单
    CONTRACT_OUTSTOCK_CUSTOM_EXPORT(XbbRefTypeEnum.CONTRACT_OUTSTOCK.getCode(),ListTopButtonEnum.CONTRACT_OUTSTOCK_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.CONTRACT_OUTSTOCK_EXPORT.getAlias()),

    // 采购退货出库单
    RETURNED_PURCHASE_OUTSTOCK_CUSTOM_EXPORT(XbbRefTypeEnum.RETURNED_PURCHASE_OUTSTOCK.getCode(),ListTopButtonEnum.RETURNED_PURCHASE_OUTSTOCK_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.RETURNED_PURCHASE_OUTSTOCK_EXPORT.getAlias()),

    // 其他出库单
    OTHER_OUTSTOCK_CUSTOM_EXPORT(XbbRefTypeEnum.OTHER_OUTSTOCK.getCode(),ListTopButtonEnum.OTHER_OUTSTOCK_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.OUTSTOCK_EXPORT.getAlias()),

    // 生产领料单
    PRODUCTION_MATERIEL_OUTSTOCK_CUSTOM_EXPORT(XbbRefTypeEnum.PRODUCTION_MATERIEL_OUTSTOCK.getCode(),ListTopButtonEnum.PRODUCTION_MATERIEL_OUTSTOCK_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.PRODUCTION_MATERIEL_OUTSTOCK_EXPORT.getAlias()),

    // 工单出库单
    WORK_ORDER_OUTSTOCK_CUSTOM_EXPORT(XbbRefTypeEnum.WORK_ORDER_OUTSTOCK.getCode(),ListTopButtonEnum.WORK_ORDER_OUTSTOCK_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.WORK_ORDER_OUTSTOCK_EXPORT.getAlias()),

    //调拨单
    TRANSFER_CUSTOM_EXPORT(XbbRefTypeEnum.TRANSFER.getCode(),ListTopButtonEnum.TRANSFER_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.TRANSFER_EXPORT.getAlias()),

    //盘点单
    INVENTORY_CUSTOM_EXPORT(XbbRefTypeEnum.INVENTORY.getCode(),ListTopButtonEnum.INVENTORY_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.INVENTORY_EXPORT.getAlias()),

    //库存查询
    STOCK_SEARCH_CUSTOM_EXPORT(XbbRefTypeEnum.STOCK_SEARCH.getCode(),ListTopButtonEnum.STOCK_SEARCH_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.STOCK_SEARCH_EXPORT.getAlias()),

    WARNING_SEARCH_CUSTOM_EXPORT(XbbRefTypeEnum.WARNING_SEARCH.getCode(),ListTopButtonEnum.STOCK_SEARCH_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.STOCK_SEARCH_EXPORT.getAlias()),

    GUARANTEE_SEARCH_CUSTOM_EXPORT(XbbRefTypeEnum.GUARANTEE_SEARCH.getCode(),ListTopButtonEnum.STOCK_SEARCH_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.STOCK_SEARCH_EXPORT.getAlias()),

    //库存流水
    STOCK_FLOW_BILL_CUSTOM_EXPORT(XbbRefTypeEnum.STOCK_FLOW_BILL.getCode(),ListTopButtonEnum.STOCK_FLOW_BILL_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.STOCK_FLOW_BILL_EXPORT.getAlias()),

    //库存台账
    STOCK_STANDING_BOOK_CUSTOM_EXPORT(XbbRefTypeEnum.STOCK_STANDING_BOOK.getCode(),ListTopButtonEnum.STOCK_STANDING_BOOK_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.STOCK_STANDING_BOOK_EXPORT.getAlias()),

    //产品
    PRODUCT_CUSTOM_EXPORT(XbbRefTypeEnum.PRODUCT.getCode(),ListTopButtonEnum.PRODUCT_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.PRODUCT_EXPORT.getAlias()),

    // 进销存跟进记录
    SUPPLIER_COMMUNICATE_CUSTOM_EXPORT(XbbRefTypeEnum.SUPPLIER_COMMUNICATE.getCode(),ListTopButtonEnum.SUPPLIER_COMMUNICATE_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.SUPPLIER_COMMUNICATE_EXPORT.getAlias()),

    //退货退款
    REFUND_CUSTOM_EXPORT(XbbRefTypeEnum.REFUND.getCode(),ListTopButtonEnum.REFUND_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.REFUND_EXPORT.getAlias()),

    //工单
    WORK_ORDER_CUSTOM_EXPORT(XbbRefTypeEnum.WORK_ORDER.getCode(),ListTopButtonEnum.WROK_ORDER_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.WORK_ORDER_EXPORT.getAlias()),

    //签到
    SIGNIN_CUSTOM_EXPORT(XbbRefTypeEnum.SIGNIN.getCode(),ListTopButtonEnum.SIGNIN_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.SIGN_IN_EXPORT.getAlias()),

    //报价单
    QUOTATION_CUSTOM_EXPORT(XbbRefTypeEnum.QUOTATION.getCode(),ListTopButtonEnum.QUOTATION_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.QUOTATION_EXPORT.getAlias()),

    //预收款列表
    PREPAYMENT_BALANCE_CUSTOM_EXPORT(XbbRefTypeEnum.PREPAYMENT_BALANCE.getCode(),ListTopButtonEnum.PREPAYMENT_BALANCE_IMPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.PAYMENT_SHEET_EXPORT.getAlias()),

    //回款单，已核销
    PAYMENT_SHEET_CUSTOM_EXPORT(XbbRefTypeEnum.PAYMENT_SHEET.getCode(),ListTopButtonEnum.PAYMENT_SHEET_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.PAYMENT_SHEET_EXPORT.getAlias()),

    //付款单，已核销
    PAY_SHEET_CUSTOM_EXPORT(XbbRefTypeEnum.PAY_SHEET.getCode(),ListTopButtonEnum.PAY_SHEET_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.PAY_SHEET_EXPORT.getAlias()),

    //预付款列表
    PREPAY_BALANCE_CUSTOM_EXPORT(XbbRefTypeEnum.PREPAY_BALANCE.getCode(),ListTopButtonEnum.PREPAY_BALANCE_IMPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.PAY_SHEET_EXPORT.getAlias()),

    // 批次流水
    BATCH_FLOW_BILL_CUSTOM_EXPORT(XbbRefTypeEnum.BATCH_FLOW_BILL.getCode(),ListTopButtonEnum.BATCH_FLOW_BILL_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.BATCH_FLOW_BILL_EXPORT.getAlias()),

    // 序列号查询
    SEQ_SEARCH_CUSTOM_EXPORT(XbbRefTypeEnum.SEQ_SEARCH.getCode(),ListTopButtonEnum.SEQ_SEARCH_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.SEQ_SEARCH_EXPORT.getAlias()),

    // 市场活动
    MARKET_ACTIVITY_CUSTOM_EXPORT(XbbRefTypeEnum.MARKET_ACTIVITY.getCode(),ListTopButtonEnum.MARKET_ACTIVITY_EXPORT, "enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT,ProPermissionAliasEnum.MARKET_ACTIVITY_EXPORT.getAlias()),
    CLUE_CUSTOM_EXPORT(XbbRefTypeEnum.ALL_CLUE.getCode(),ListTopButtonEnum.CLUE_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.CLUE_EXPORT.getAlias()),
    CLUE_PUBLIC_CUSTOM_EXPORT(XbbRefTypeEnum.CLUE_PUBLIC.getCode(),ListTopButtonEnum.CLUE_PUBLIC_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.CLUE_EXPORT.getAlias()),
    CLUE_RECYCLE_CUSTOM_EXPORT(XbbRefTypeEnum.CLUE_RECYCLE.getCode(),ListTopButtonEnum.CLUE_RECYCLE_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.CLUE_EXPORT.getAlias()),

    //其他收入单
    OTHER_INCOME_CUSTOM_EXPORT(XbbRefTypeEnum.OTHER_INCOME.getCode(),ListTopButtonEnum.OTHER_INCOME_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.OTHER_INCOME_EXPORT.getAlias()),
    //其他支出单
    OTHER_EXPENSE_CUSTOM_EXPORT(XbbRefTypeEnum.OTHER_EXPENSE.getCode(),ListTopButtonEnum.OTHER_EXPENSE_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.OTHER_EXPENSE_EXPORT.getAlias()),
    //资金调拨单
    FUND_TRANSFER_CUSTOM_EXPORT(XbbRefTypeEnum.FUND_TRANSFER.getCode(),ListTopButtonEnum.FUND_TRANSFER_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.FUND_TRANSFER_EXPORT.getAlias()),

    // 经销商
    DISTRIBUTOR_MANAGEMENT_CUSTOM_EXPORT(XbbRefTypeEnum.DISTRIBUTOR_MANAGEMENT.getCode(),ListTopButtonEnum.DISTRIBUTOR_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT,ProPermissionAliasEnum.DISTRIBUTOR_EXPORT.getAlias()),
    DISTRIBUTOR_CONTACT_CUSTOM_EXPORT(XbbRefTypeEnum.DISTRIBUTOR_CONTACT.getCode(),ListTopButtonEnum.DISTRIBUTOR_CONTACT_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT,ProPermissionAliasEnum.DISTRIBUTOR_CONTACT_EXPORT.getAlias()),
    DISTRIBUTOR_COMMUNICATE_CUSTOM_EXPORT(XbbRefTypeEnum.DISTRIBUTOR_COMMUNICATE.getCode(),ListTopButtonEnum.DISTRIBUTOR_COMMUNICATE_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT,ProPermissionAliasEnum.DISTRIBUTOR_COMMUNICATE_EXPORT.getAlias()),
    DISTRIBUTOR_ACCOUNT_CUSTOM_EXPORT(XbbRefTypeEnum.DISTRIBUTOR_ACCOUNT.getCode(),ListTopButtonEnum.DISTRIBUTOR_ACCOUNT_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT,ProPermissionAliasEnum.DISTRIBUTOR_ACCOUNT_EXPORT.getAlias()),
    ORDER_CUSTOM_EXPORT(XbbRefTypeEnum.ORDER.getCode(),ListTopButtonEnum.ORDER_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT,ProPermissionAliasEnum.ORDER_EXPORT.getAlias()),
    RETURN_CUSTOM_EXPORT(XbbRefTypeEnum.RETURN.getCode(),ListTopButtonEnum.RETURN_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT,ProPermissionAliasEnum.RETURN_EXPORT.getAlias()),
    ORDER_OUTSTOCK_CUSTOM_EXPORT(XbbRefTypeEnum.ORDER_OUTSTOCK.getCode(),ListTopButtonEnum.ORDER_OUTSTOCK_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT,ProPermissionAliasEnum.ORDER_EXPORT.getAlias()),

    // 资金管理-在线支付流水/信用管理（信用额度/临时额度/固定额度）
    ONLINE_PAYMENT_FLOW_CUSTOM_EXPORT(XbbRefTypeEnum.ONLINE_PAYMENT_FLOW.getCode(),ListTopButtonEnum.ONLINE_PAYMENT_FLOW_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT,ProPermissionAliasEnum.ONLINE_PAYMENT_FLOW_EXPORT.getAlias()),
    CREDIT_LIMIT_FLOW_CUSTOM_EXPORT(XbbRefTypeEnum.CREDIT_LIMIT.getCode(),ListTopButtonEnum.CREDIT_LIMIT_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT,ProPermissionAliasEnum.CREDIT_LIMIT_EXPORT.getAlias()),
    CREDIT_TEMPORARY_LIMIT_CUSTOM_EXPORT(XbbRefTypeEnum.CREDIT_TEMPORARY_LIMIT.getCode(),ListTopButtonEnum.CREDIT_TEMPORARY_LIMIT_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT,ProPermissionAliasEnum.CREDIT_TEMPORARY_LIMIT_EXPORT.getAlias()),
    CREDIT_FIXED_LIMIT_CUSTOM_EXPORT(XbbRefTypeEnum.CREDIT_FIXED_LIMIT.getCode(),ListTopButtonEnum.CREDIT_FIXED_LIMIT_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT,ProPermissionAliasEnum.CREDIT_FIXED_LIMIT_EXPORT.getAlias()),

    // 营销管理-营销工具（营销活动管理）/促销工具（促销活动管理）
    MARKETING_ACTIVITY_MANAGEMENT_CUSTOM_EXPORT(XbbRefTypeEnum.MARKETING_ACTIVITY_MANAGEMENT.getCode(),ListTopButtonEnum.MARKETING_ACTIVITY_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT,ProPermissionAliasEnum.MARKETING_ACTIVITY_EXPORT.getAlias()),
    PROMOTION_ACTIVITY_MANAGEMENT_EXPORT(XbbRefTypeEnum.PROMOTION_ACTIVITY_MANAGEMENT.getCode(),ListTopButtonEnum.PROMOTION_ACTIVITY_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT,ProPermissionAliasEnum.PROMOTION_ACTIVITY_EXPORT.getAlias()),

    // 产品-产品价目查询
    PRICE_SET_PRODUCT_EXPORT(XbbRefTypeEnum.PRICE_SET_PRODUCT.getCode(),ListTopButtonEnum.PRODUCT_PRICE,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT,ProPermissionAliasEnum.PRICE_PRODUCT_EXPORT.getAlias()),

    // 成本调整单
    COST_ADJUST_CUSTOM_EXPORT(XbbRefTypeEnum.COST_ADJUST.getCode(),ListTopButtonEnum.COST_ADJUST_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.COST_ADJUST_EXPORT.getAlias()),

    // 待入库
    INSTOCK_WAIT_CUSTOM_EXPORT(XbbRefTypeEnum.WAIT_INSTOCK_PURCHASE.getCode(),ListTopButtonEnum.INSTOCK_WAIT_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.PENDING_INSTOCK_EXPORT.getAlias()),

    // 待出库
    OUTSTOCK_WAIT_CUSTOM_EXPORT(XbbRefTypeEnum.WAIT_OUTSTOCK.getCode(),ListTopButtonEnum.OUTSTOCK_WAIT_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.PENDING_OUTSTOCK_EXPORT.getAlias()),

    // 待采购
    WAIT_PURCHASE_EXPORT(XbbRefTypeEnum.WAIT_PURCHASE.getCode(),ListTopButtonEnum.WAIR_PURCHASE_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.ORDER_ON_PIN_EXPORT.getAlias()),

    // 智能补货
    SMART_REPLENISHMENT_EXPORT(XbbRefTypeEnum.SMART_REPLENISHMENT.getCode(),ListTopButtonEnum.SMART_REPLENISHMENT_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.SMART_REPLENISHMENT_EXPORT.getAlias()),

    // 竞争对手
    COMPETITOR_EXPORT(XbbRefTypeEnum.COMPETITOR.getCode(),ListTopButtonEnum.COMPETITOR_EXPORT,"enum.SaasSubButtonEnum.name.custom_export",SaasButtonEnum.CUSTOM_EXPORT.getAttr(),"",SaasButtonEnum.EXPORT, ProPermissionAliasEnum.COMPETITOR_EXPORT.getAlias()),

    ;



    private Integer businessType;

    private ListTopButtonEnum listTopButtonEnum;
    /**
     * saas应用标示解释
     */
    private String name;
    /**
     * saas应用标示
     */
    private String alias;

    private String icon;

    /**
     * 父级枚举
     */
    private SaasButtonEnum parentEnum;

    private String proPermissionAlias;

    SaasSubButtonEnum(Integer businessType,ListTopButtonEnum listTopButtonEnum, String name, String alias, String icon, SaasButtonEnum parentEnum,String proPermissionAlias) {
        this.businessType = businessType;
        this.listTopButtonEnum = listTopButtonEnum;
        this.name = name;
        this.alias = alias;
        this.icon = icon;
        this.parentEnum = parentEnum;
        this.proPermissionAlias = proPermissionAlias;
    }

    public static List<SaasSubButtonEnum> getByPermissionAlias(Integer businessType, ListTopButtonEnum listTopButtonEnum, Set<String> permSet) {
        List<SaasSubButtonEnum> list = new ArrayList<>();
        for(SaasSubButtonEnum buttonEnum: values()) {
            if(Objects.equals(buttonEnum.getBusinessType(),businessType) && Objects.equals(buttonEnum.getListTopButtonEnum(),listTopButtonEnum) && permSet.contains(buttonEnum.getProPermissionAlias())) {
                list.add(buttonEnum);
            }
        }
        return list;
    }

    public static List<SaasSubButtonEnum> getList() {
        return new ArrayList<>(Arrays.asList(values()));
    }


    public String getName() {
        return I18nMessageUtil.getMessage(name);
    }

    public String getI18nName() {
        return name;
    }
}
